<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%-- 
    JSP Name : view.jsp
    Description : 이벤트 상세 내역을 보여준다.
    author jkKim
    since 2012. 5. 10.
    version 1.0
    Modification Information
       since          author              description
    ===========    =============    ===========================
    2012. 5. 10.     jkKim     최초 생성
--%>
<%@ include file="/WEB-INF/jsp/com/include/declare.jspf" %>
<%@ include file="/WEB-INF/jsp/com/include/doctype.jspf" %>
<script type="text/javascript" src="/kr/common/js/ajaxupload.js"></script>
<script>
var uploadFiles=[]; 
document.domain="hyundai.com" ;

function pushFiles(file){
    uploadFiles.push(file); 
}
function evntUpload(type){
    var list = $(".survey-wrap .section");  
    if(uploadFiles.length > 0){
        var uploadFile = uploadFiles.pop();
        uploadFile.submit();
    }else{
        evntInsert(type);  
    }    
}

function evntInsertCheck(type){
    var evntPtcChidVO = $("#evntPtcChidVO").val();
    var userInfo = $("#userInfo").val();
    if(!userInfo){
       isLogin();
       return;
    }
    if(evntPtcChidVO){
       alert("이미 이벤트에 응모 하셨습니다.");
       return;
    }
    if(type=='E1'){
        openLayer();
    }else if(type=='E2'){
        openLayer();
    }else if(type=='E3'){
        var list = $(".survey-wrap .section");
        var formAsw = $("#evntAsw");
        $("#evntAsw [name='evntIsvyMnSn']").remove();
        $("#evntAsw [name='asw']").remove();
        var b = true;
        list.each(function(){
            if(!b){return;}
            var qustK = $(this).find(" [name='qustK']").val();
            var evntIsvyMnSn = $(this).find(" [name='evntIsvyMnSn']").val();
            var choiPsblIct = $(this).find(" [name='choiPsblIct']").val();
            if(qustK == "Q1"){// 객관식
                var asw = "";
                if(choiPsblIct == 1){
                    var aswTemp = $(this).find(":radio[name='E"+evntIsvyMnSn+"']:checked");
                    
                    var tempRspYnList = $(this).find(":radio[name='E"+evntIsvyMnSn+"']");
                    var rspYn = false;
                    tempRspYnList.each(function(){
                        if($(this).attr("rspYn") == "Y"){
                            rspYn = true;
                        }
                    });
                    if(!aswTemp.val()){
                        alert("정답을 선택해 주세요.");
                        b = false;
                        tempRspYnList.eq(0).focus();
                        return; 
                    }else if(rspYn && aswTemp.attr("rspYn") != "Y"){ 
                        alert("정답이 아닙니다. 다시 한번 생각해 보시기 바랍니다.");
                        aswTemp.eq(0).focus();
                        b = false;
                        return;
                    }
                    asw = $(this).find(":radio[name='E"+evntIsvyMnSn+"']:checked").val();
                }else{
                    var aswList = $(this).find("input[name='E"+evntIsvyMnSn+"']:checked");
                    
                    var tempRspYnList = $(this).find("input[name='E"+evntIsvyMnSn+"']");
                    
                    var rspYn = false;
                    tempRspYnList.each(function(){
                        if($(this).attr("rspYn") == "Y"){
                            rspYn = true;
                        }
                    });
                    
                    
                    if(aswList.size()==0){
                        alert("정답을 선택해 주세요.");
                        b = false;
                        tempRspYnList.eq(0).focus();
                        return;
                    }
                    if(rspYn){
                        var tempBoolean =false;
                        aswList.each(function(){
                            if($(this).attr("rspYn") != "Y"){
                                tempBoolean = true;
                            }
                        });
                        if(tempBoolean){ 
                            alert("정답이 아닙니다. 다시 한번 생각해 보시기 바랍니다.");
                            b = false;
                            tempRspYnList.eq(0).focus();
                            return;
                            
                        } 
                    }else{
                        
                    }
                    
                }
            }
            if(qustK == "Q2"){// 차수선택
                var asw = $(this).find("select[name='E"+evntIsvyMnSn+"']").val();
            }
            if(qustK == "Q3"){// 파일업로드
                var asw = $(this).find("input[name='UP"+evntIsvyMnSn+"']").val();
                if(!asw){
                    alert("파일업로드 해주세요.");
                    b = false;
                    return;
                }
            }
            if(qustK == "Q4"){// 주관식 
                var asw = $(this).find("input[name='E"+evntIsvyMnSn+"']").val();
                if(!asw){
                    alert("주관식을 입력해 주세요.");
                    $(this).find("input[name='E"+evntIsvyMnSn+"']").focus();
                    b = false;
                    return;
                }
            }            
        });
        if(b){
            openLayer();
        }
    }
}
function evntInsert(type){
    //survey-wrap section
    if(type='E3'){
        var list = $(".survey-wrap .section");
        var formAsw = $("#evntAsw");
        $("#evntAsw [name='evntIsvyMnSn']").remove();
        $("#evntAsw [name='asw']").remove();
        list.each(function(){
            var qustK = $(this).find(" [name='qustK']").val();
            var evntIsvyMnSn = $(this).find(" [name='evntIsvyMnSn']").val();
            var choiPsblIct = $(this).find(" [name='choiPsblIct']").val();
            
            if(qustK == "Q1"){// 객관식
                var asw = "";
                
                if(choiPsblIct == 1){
                    asw = $(this).find(":radio[name='E"+evntIsvyMnSn+"']:checked").val();
                    
                    formAsw.append("<input type='hidden' name='asw' value='"+asw+"'/>");
                    formAsw.append("<input type='hidden' name='qustK' value='"+qustK+"'/>");
                    formAsw.append("<input type='hidden' name='evntIsvyMnSn' value='"+evntIsvyMnSn+"'/>");
                    
                }else{
                    var aswList = $(this).find("input[name='E"+evntIsvyMnSn+"']:checked");
                    for(var i=0; i<aswList.length;i++){
                        if(asw.length==0){
                            asw+=aswList[i].value;
                        }else{
                            asw+=","+aswList[i].value;
                        }
                    }
                    formAsw.append("<input type='hidden' name='asw' value='"+asw+"'/>");
                    formAsw.append("<input type='hidden' name='qustK' value='"+qustK+"'/>");
                    formAsw.append("<input type='hidden' name='evntIsvyMnSn' value='"+evntIsvyMnSn+"'/>");
                }
                
            }
            
            if(qustK == "Q2"){// 차수선택
                var asw = $(this).find("select[name='E"+evntIsvyMnSn+"']").val();
                formAsw.append("<input type='hidden' name='asw' value='"+asw+"'/>");
                formAsw.append("<input type='hidden' name='qustK' value='"+qustK+"'/>");
                formAsw.append("<input type='hidden' name='evntIsvyMnSn' value='"+evntIsvyMnSn+"'/>");
                            
            }
                        
            if(qustK == "Q3"){// 파일업로드
                //uploadFiles["U"+evntIsvyMnSn].submit();
                var asw = $(this).find("input[name='E"+evntIsvyMnSn+"']").val();                
                
                formAsw.append("<input type='hidden' name='asw' value='"+asw+"'/>");
                formAsw.append("<input type='hidden' name='qustK' value='"+qustK+"'/>");
                formAsw.append("<input type='hidden' name='evntIsvyMnSn' value='"+evntIsvyMnSn+"'/>");
            }
            
            if(qustK == "Q4"){// 주관식 
                var asw = $(this).find("input[name='E"+evntIsvyMnSn+"']").val();
                formAsw.append("<input type='hidden' name='asw' value='"+asw+"'/>");
                formAsw.append("<input type='hidden' name='qustK' value='"+qustK+"'/>");
                formAsw.append("<input type='hidden' name='evntIsvyMnSn' value='"+evntIsvyMnSn+"'/>");
                
            }
            
            
        });
        
        var evntIsvyMnSns = $("#evntAsw input[name=evntIsvyMnSn]");
        var asws = $("#evntAsw input[name=asw]");
        var qustKs = $("#evntAsw input[name=qustK]");
        
        if(evntIsvyMnSns.size() != asws.size()){
          
        }
        var evntIsvyMnSn = "";
        var asw = "";
        var qustK = "";
        for(var i=0;i<evntIsvyMnSns.size();i++){
            if(evntIsvyMnSn.length>0){
                evntIsvyMnSn +="#:#"+ evntIsvyMnSns[i].value;
                asw += "#:#"+ asws[i].value;
                qustK += "#:#"+ qustKs[i].value;
            }else{
                evntIsvyMnSn = evntIsvyMnSns[i].value;
                asw = asws[i].value;
                qustK = qustKs[i].value;
            }
        }
        
        var evntMnSn = $("#evntMnSn").val();
        var evntPtcChidSn = $("#evntPtcChidSn").val();
        var evntType = $("#evntType").val();
         
        var hpNo1 = $("#hpNo1");
        var hpNo2 = $("#hpNo2");
        var hpNo3 = $("#hpNo3");
        var zipSn1 = $("#zipSn01");
        var zipSn2 = $("#zipSn02"); 
        var adr = $("#adr");
        var dtlAdr = $("#dtlAdr");
        
        var year = $("#year");
        var mon = $("#mon");
        var day = $("#day");
        var ptcChidSex = $("#ptcChidSex");
        
        
        var evntMnSn = $("#evntMnSn").val();
        var evntType = $("#evntType").val();
        var reb = $("#reb").val();
        var hpNo = hpNo1.val()+hpNo2.val()+hpNo3.val();
        var ptcChidNm = $("#ptcChidNm").val();
        var zipScn = $("#zipScn").val();
        var ptcChidTymd = $("#ptcChidTymd").val();
        
        var addrCheck = 1;
          
        var param= {
                'ptcChidNm' : ptcChidNm,
                'ptcChidHpNo' : hpNo,
                'zipSn' : zipSn1.val()+zipSn2.val(),
                'ptcChidTymd' : year.val()+mon.val()+day.val(),
                'adr' : adr.val(),
                'dtlAdr' : dtlAdr.val(),
                'evntMnSn' : evntMnSn,
                'evntType' : evntType,
                'addrCheck' : addrCheck ,
                'reb' : reb,
                'ptcChidSex' : ptcChidSex.val(),
                'evntIsvyMnSn' : evntIsvyMnSn,
                'asw' : asw,
                'evntMnSn' : evntMnSn,
                'evntType' : evntType,
                'qustK' : qustK,
                'zipScn' : zipScn
            };
        setSnsParam(param);
        pub5.popSNS();
        $.ajax({
            type: "POST",
            dataType : "xml",
            url: "<c:url value='/evnt/updateEvntPtc.do'/>",
            data: param,
            success: function(data){
                var result = {};
                var items = $(data).find("item");
                items.each(function(index, element) {
                    var name = $(this).find("name").text();
                    var value = $(this).find("value").text();
                    result[name] = value;
                });
                
                if (result["result"] == "OK") {
                    closeLayer();
                    alert("이벤트에 참여 되었습니다.");
                    location.href = "<c:url value='/evnt/selectEvntMnDetail.do'/>?evntMnSn=${result.evntMnSn}&pageIndex="+1;
                }
            }
            });
    }
}


var option = {        
        uploadName : 'mnImgUpload',
        fileReturnValue : '',
        fileImgDiv : 'mnImgDownfile',
        fileReturnType : 'path',
        fileSelectFailMessage : '<spring:message code="script.errorMessage.fileSelect" />',
        fileSuccessMessage : '<spring:message code="script.message.fileSuccess" />',
        fileExt : '',
        action: '/upload.do', 
        data : {
            //이미지 타입
            'fileType' : 'evnt',
            //파일 업로드 하위 경로
            'path' : 'evntUser/${result.evntMnSn }'
            },
        autoSubmit: false,
        onChange: function(file, ext){ 
            if(this.fileExt.indexOf(ext) == -1){
                if(this.fileReturnValue)
                    $("#"+this.fileReturnValue).val('');
                if(this.fileNameValue)
                    $("#"+this.fileNameValue).val('');
                alert("업로드 확장자를 확인해 주시기 바랍니다.");
                return false;
            }
            var fileNameValue = $('#'+this.fileNameValue);
                fileNameValue.val(file);
            return true;
        },
        onSubmit : function(file, ext){
            if(this.fileExt.indexOf(ext) == -1){
                alert("확장자 확인하라구!!!");
                return false;
            }
            if(file == null || file == ""){
                alert(this.fileSelectFailMessage);
                return false;
            }
            this.disable();  
        },
        onComplete: function(file, response){
            this.enable();
            var result={};
            var items = $(response).find("item");
            items.each(function(index,element){
               var name = $(this).find("name").text();
               var value = $(this).find("value").text();
               result[name] = value;
            });
            alert($("#"+this.fileReturnValue).size());
            $("#"+this.fileReturnValue).val(result["filSn"]);
            this.callback("E3");
        },
        callback : function(type){
            if(uploadFiles.length > 0){
                var uploadFile = uploadFiles.pop();
                uploadFile.submit();
            }else{
                evntInsert(type);
            }
        }
};  
function fromNull(o){
    
    if(o.type && o.type == "textarea"){
        o.innerText="";
        fromNull = function(o){
        }
    }
} 
 
function insertReb(){
    if(!isLogin()){
        return;
    } 
    fromNull($("#reb")[0]);
    var evntPtcChidVO = $("#evntPtcChidVO").val();
    if(evntPtcChidVO){
       alert("이미 이벤트에 응모 하셨습니다.");
       return;
    }
    var reb = $("#reb").val();
    if(reb==""){
        alert("댓글을 입력해 주세요.");
        $("#reb").focus()
        return;
    }
    openLayer();
}

function evntEnd(param){
    var evntType = $("#evntType").val();
    var reb = $("#reb").val();
    
    if(evntType=="E1"){
        pub5.popSNS();
        $.ajax({
            type: "POST",
            dataType : "xml",
            url: "<c:url value='/evnt/insertEvntPtc.do'/>",
            data: param,
            success: function(data){
                var result = {};
                var items = $(data).find("item");
                items.each(function(index, element) {
                    var name = $(this).find("name").text();
                    var value = $(this).find("value").text();
                    result[name] = value;
                });
                
                if (result["result"] == "OK") {
                    var form = document.serchForm;
                    $("#resultValue").val(result["result"]);
                    $("#evntPtcChidSn").val(result["evntPtcChidSn"]);
                    closeLayer();
                    alert("정상적으로 이벤트에 참여 되었습니다.");
                    location.href = "<c:url value='/evnt/selectEvntMnDetail.do'/>?evntMnSn=${result.evntMnSn}&pageIndex="+1;
                    //form.submit();  
                }
            }
        });
    }else if(evntType=="E2"){
        param['reb']=reb;
        pub5.popSNS();
        $.ajax({
            type: "POST",
            dataType : "xml",
            url: "<c:url value='/evnt/updateEvntPtc.do'/>",
            data: param,
            success: function(data){
                var result = {};
                var items = $(data).find("item");
                items.each(function(index, element) {
                    var name = $(this).find("name").text();
                    var value = $(this).find("value").text();
                    result[name] = value;
                });
                
                if (result["result"] == "OK") {
                    closeLayer();
                    alert("이벤트에 참여 되었습니다.");
                    location.href = "<c:url value='/evnt/selectEvntMnDetail.do'/>?evntMnSn=${result.evntMnSn}&pageIndex="+1;
                }
            }
        });
    }else if(evntType=="E3"){
        evntUpload(evntType);
    }
    
    
    
}

function openLayer(){
    
    var evntMnSn = $("#evntMnSn").val();
    var evntType = $("#evntType").val();
    
    $.ajax({
        type: "GET",
        dataType : "text",
        url: "<c:url value='/evnt/eventPtcChidLayer.do'/>",
        data: { 
            'evntMnSn' : evntMnSn,
            'evntType' : evntType
        },
        success: function(data){
            $("#layerpopup-evnt").html('');
            $("#layerpopup-evnt").append(data);
            $('body').dimmedFrame();
            
            var wHeight = $(window).height();
            var divHeight = $("#personinfopopup").height();
            if(divHeight > wHeight){
                $("#personinfopopup").css({top:$(window).scrollTop()}).show();    
            }else{
                $("#personinfopopup").css({top:$(window).scrollTop()+((wHeight - divHeight) /2)}).show();
            }
        }
    }); 
}

function closeLayer(){
    $('.dimmed-frame').remove();  
    $("#personinfopopup").hide(); 
}

function fnLinkPage(pageIndex) {
    //$("#pageIndex").val(pageIndex);
    //var form = document.serchForm;
    location.href = "<c:url value='/evnt/selectEvntMnDetail.do'/>?evntMnSn=${result.evntMnSn}&pageIndex="+pageIndex;
    //form.submit();
}

function deletePtcChid(evntPtcChidSn){
    $.ajax({
        type: "POST",
        dataType : "xml",
        url: "<c:url value='/evnt/deleteEvntPtc.do'/>",
        data: {
            'evntPtcChidSn' : evntPtcChidSn
        },
        success: function(data){
            var result = {};
            var items = $(data).find("item");
            items.each(function(index, element) {
                var name = $(this).find("name").text();
                var value = $(this).find("value").text();
                result[name] = value;
            });
            
            if (result["result"] == "OK") {
                closeLayer();
                alert("댓글의 삭제에 성공하였습니다.");
                location.href = "<c:url value='/evnt/selectEvntMnDetail.do'/>?evntMnSn=${result.evntMnSn}&pageIndex="+1;
            }
        }
    });
    
}

function evntInsertBe(){   
    var insertUserCheck = $("#insertUserCheck").attr("checked");
    var insertUserCheck1 = $("#insertUserCheck1").attr("checked");
    var insertUserCheck2 = $("#insertUserCheck2").attr("checked");
    if(insertUserCheck){
    
    }else{
        alert("개인정보 수집 및 이용 목적에 동의해 주십시오.");
        $("#insertUserCheck").focus();
        return; 
    }
    if(insertUserCheck1){
        
    }else{
        alert("마케팅 활용에 동의해 주십시오.");
        $("#insertUserCheck1").focus();
        return; 
    }
    if(insertUserCheck2){
        
    }else{
        alert("개인정보 보유 및 이용기간에 동의해 주십시오.");
        $("#insertUserCheck2").focus();
        return; 
    }
    var hpNo1 = $("#hpNo1");
    var hpNo2 = $("#hpNo2");
    var hpNo3 = $("#hpNo3");
    var zipSn1 = $("#zipSn01");
    var zipSn2 = $("#zipSn02");
    var adr = $("#adr");
    var dtlAdr = $("#dtlAdr");
    
    var year = $("#year");
    var mon = $("#mon");
    var day = $("#day");
    var ptcChidSex = $("#ptcChidSex");
     
    if(hpNo2.val() == ""){
        alert("전화번호를 입력해 주세요.");
        hpNo2.focus();
        return;
    }
    if(hpNo3.val() == ""){
        alert("전화번호를 입력해 주세요.");
        hpNo3.focus();
        return;
    }
    
    if(zipSn1.val() == "" || zipSn2.val() == "" || adr.val() == ""){
        alert("우편번호 검색을 해주세요.");
        adr.focus();
        return;
    }
    
    if(dtlAdr.val() == ""){
        alert("상세 주소를 입력해주세요.");
        dtlAdr.focus();
        return;
    }
    
    var evntMnSn = $("#evntMnSn").val();
    var evntType = $("#evntType").val();
    var reb = $("#reb").val();
    var hpNo = hpNo1.val()+hpNo2.val()+hpNo3.val()
    var addrCheck = 1;
    var ptcChidNm = $("#ptcChidNm").val();
    var zipScn = $("#zipScn").val();
    var ptcChidTymd = $("#ptcChidTymd").val();
    
    
    
    
    var param= {
            'ptcChidNm' : ptcChidNm,
            'ptcChidHpNo' : hpNo,
            'zipSn' : zipSn1.val()+zipSn2.val(),
            'ptcChidTymd' : year.val()+mon.val()+day.val(),
            'adr' : adr.val(),
            'dtlAdr' : dtlAdr.val(),
            'evntMnSn' : evntMnSn,
            'evntType' : evntType,
            'addrCheck' : addrCheck ,
            'reb' : reb,
            'ptcChidSex' : ptcChidSex.val(),
            'zipScn' : zipScn
        };
    
    setSnsParam(param);
    evntEnd(param);
}

function setSnsParam(param){
    var user = pub5.getUserSNS();
    var ptChidImgPath = '';
    var ptcChidNick = '';
    var ptcChidLk = '';
    var ptcChidType = ''; 
    if(user){
        if(user.img){
            ptChidImgPath = user.img;
        }
        
        if(user.sns_type){
            ptcChidType = user.sns_type;
        }
        
        if(user.nick){
            ptcChidNick = user.nick;
        }
        
        if(user.link){
            ptcChidLk = user.link;
        }
    }
    
    if(ptChidImgPath){
        param["ptChidImgPath"]=ptChidImgPath;
    }
    
    if(ptcChidNick){
        param["ptcChidNick"]=ptcChidNick;
    }
    
    if(ptcChidLk){
        param["ptcChidLk"]=ptcChidLk;
    }
    
    if(ptcChidType){
        param["ptcChidType"]=ptcChidType;
    }
}

function zipCodePopUp(obj) {
   window.open("/kr/mbr/zipCodePopUp.do","우편번호찾기","top=500px,left=800px,height=950px,width=660px,scrollbars=yes,menubar=no,toolbar=no,status=no");
}
function check20(){
    if(!isLogin()){
        return;
    } 
    var evntPtcChidVO = $("#evntPtcChidVO").val();
    if(evntPtcChidVO){
       alert("이미 이벤트에 응모 하셨습니다.");
       document.body.focus(); 
       return; 
    }
}
function check10(o){
    check20();
    var tempBoolean =false; 
    if(o.type == "radio"){
        var aswTemp = $(":radio[name='"+o.name+"']:checked");
        if(aswTemp.size()>0){
            var aswList = $(":radio[name='"+o.name+"']");
            aswList.each(function(){
                if($(this).attr("rspYn") == "Y"){
                    tempBoolean = true;
                }
            });
            if(tempBoolean){ 
                if($(o).attr("rspYn") != "Y" ){
                    alert("정답아닙니다!");
                    $(o).attr("checked",false);
                    $(o).focus();
                    return;
                } 
            }
        }
    }else if(o.type == "checkbox"){
        var aswTemp = $("input[name='"+o.name+"']:checked");
        if(aswTemp.size()>0){
            
            var aswList = $("input[name='"+o.name+"']");
            aswList.each(function(){
                if($(this).attr("rspYn") == "Y"){
                    tempBoolean = true;
                }
            });  
            
            if(tempBoolean){ 
                if($(o).attr("rspYn") != "Y" ){
                    alert("정답아닙니다!");
                    $(o).attr("checked",false);
                    $(o).focus(); 
                    return;
                }
            }
        }
    }
} 
$(document).ready(function(){ 
    //$("#snml .snml_URL").text(location.href);
      
});
</script>
</head>
<body>
<form method="get" action="<c:url value='/evnt/selectEvntMnPaging.do'/>" name="serchForm" id="serchForm" onsubmit="return false">
<input type="hidden" name="pageIndex" id="pageIndex" value="${evntMnSearchVO.pageIndex}">
</form>

<!-- 개인정보입력 -->
<div id="personinfopopup" class="layerpopup personinfopopup" style="width:502px"><div class="layerpopup-inner">
    <div class="layerpopup-head">
        <h1><img src="/kr/images/layerpopup/h1_person_info02.gif" alt="개인정보 수집, 이용에 관한 안내" /></h1>
    </div>
    <div class="collect-wrap02">
        <div class="rule"><div class="inner"> 
        ${agrSbcMgmtVO.sbc1 }   
        </div></div>
        <p class="collect-notice"><img src="/kr/images/layerpopup/txt_person_info09.gif" alt="이벤트 응모 사항에 한하여 이메일/휴대전화 수신거부는 수신허용으로 간주됩니다" /></p>
        <div class="etc-function">
            <label><input type="checkbox" class="check" id="insertUserCheck"/> 개인정보 수집 및 이용 목적에 동의합니다. (동의하지 않을 경우 신청 되지 않습니다.)</label>
            <br/><label><input type="checkbox" class="check" id="insertUserCheck1"/> 마케팅 활용에 동의합니다. (동의하지 않을 경우 신청 되지 않습니다.)</label>
            <br/><label><input type="checkbox" class="check" id="insertUserCheck2"/> 개인정보 보유 및 이용기간에 동의합니다. (동의하지 않을 경우 신청되지 않습니다.)</label>
        </div>
    </div>
    <div class="layerpopup-head">
        <h1><img src="/kr/images/layerpopup/h1_person_info.gif" alt="개인정보입력" /></h1>
        <p class="desc"><img src="/kr/images/layerpopup/h1_person_info_desc.gif" alt="이벤트 응모 및 경품 수령 등을 위한 고객님의 정확한 정보를 확인, 입력해 주세요." /></p>
    </div>
    <div class="layerpopup-contents" id="layerpopup-evnt">
        
    </div>
    <!-- close -->
    <div class="close-area"><div class="close-area-inner">
        <img src="/kr/images/layerpopup/btn_close.gif" alt="닫기" class="close" />
    </div></div>
    <!-- //close -->
</div></div>
<!-- //개인정보입력 -->
<div id="wrap" class="non-subnavigation">
    <%@ include file="/WEB-INF/jsp/com/include/navi_utill_sub.jspf" %>
    <%@ include file="/WEB-INF/jsp/com/include/navi_header.jspf" %>
    <hr />
  
    <%@ include file="/WEB-INF/jsp/com/include/sub_header_event.jspf" %>
    <hr />
    <input type="hidden" id="event_code" value="${result.evntMnSn }"/>
    <input type="hidden" id="event_name" value="${result.evntTitl }"/>
    <!-- SNML 환경변수 -->
    <div id="snml" style="display:none">
      <div class="snml_comment">${result.evntTitl }</div>
      <div class="snml_title">${result.evntTitl }</div>
      <div class="snml_URL">${httpsDomain }<c:url value='/evnt/selectEvntMnDetail.do?evntMnSn=${result.evntMnSn }'/></div>
      <div class="snml_img">${httpsDomain }<c:url value='${result.thumnImgPath}'/></div>
      <div class="snml_caption"></div>
      <div class="snml_description">${result.evntSbc}</div> 
    </div> 
    <div id="container">
        <div id="subtitle-area"><div class="subtitle-area-inner">
            <%@ include file="/WEB-INF/jsp/com/include/location.jspf" %>
        </div></div>
        <div id="article">
            <p class="default-desc"><img src="/kr/images/event/txt_event01_01.gif" alt="고객님을 위한 스페셜 이벤트! 즐거운 행운과 경품을 만나보세요!" /></p>
            <form action="" id="evntAsw">
                <input type="hidden" id="evntMnSn" value="${result.evntMnSn }"/>
                <input type="hidden" id="evntPtcChidSn" value=""/>
                <input type="hidden" id="evntType" value="${result.evntType}"/>
                <input type="hidden" id="userInfo" value="${userInfo.mbrNm}"/>
                <input type="hidden" id="ptcChidTymd" value="${fn:substring(result.fnhDt, 0, 8)}"/>
                
                <c:if test="${evntPtcChidVO == null}">
                    <input type="hidden" id="evntPtcChidVO" value=""/>
                </c:if>
                <c:if test="${evntPtcChidVO != null}">
                    <input type="hidden" id="evntPtcChidVO" value="${evntPtcChidVO.evntPtcChidSn}"/>
                </c:if>
            </form>
            <c:if test="${result.evntType == 'E4'}">
                ${result.dtlImg}
            </c:if>
            <c:if test="${result.evntType == 'E1'}">
                ${result.dtlImg}
            </c:if>
            <c:if test="${result.evntType == 'E2'}">
                ${result.dtlImg}
            <div class="reply-wrap">
                <div class="input-area">
                    <div class="title-sns-area">
                        <p class="title"><img src="/kr/images/event/txt_event01_07.gif" alt="댓글입력" /></p>
                        <div class="sns-area">
                            <c:if test="${userInfo.mbrSn == null}">
                                <script type="text/javascript" charset="utf-8" src="${snsHttpsDomain}/sns/pub?type=5&js=1&uKey="></script>
                            </c:if>
                            <c:if test="${userInfo.mbrSn != null}">
                                <script type="text/javascript" charset="utf-8" src="${snsHttpsDomain}/sns/pub?type=5&js=1&uKey=${fnc:encryptCb(userInfo.mbrSn) }"></script>
                            </c:if>
                        </div>
                    </div>
                    <div class="input-wrap">
<textarea onfocus="fromNull(this)" id="reb" name="reb">
댓글을 입력한 내용이 노출 됩니다.
</textarea>
                        <a href="javascript:insertReb()"><img src="/kr/images/common/button/btn_input.gif" alt="입력" class="button" /></a>
                    </div>
                </div>
                <jsp:scriptlet>
                        pageContext.setAttribute("crlf", "\r\n");
                        pageContext.setAttribute("lf", "\n");
                        pageContext.setAttribute("cr", "\r");
                </jsp:scriptlet>  
                <div class="reply-list-wrap">
                    <div class="section">
                    <c:if test="${evntPtcChidVO != null}">    
                        <c:if test="${evntPtcChidVO.ptChidImgPath == null}">
                            <img src="/kr/temp/@none_50x50.jpg" alt="참여고객 이미지" class="thumb" />
                        </c:if>
                        <c:if test="${evntPtcChidVO.ptChidImgPath != null}">
                            <img src="${evntPtcChidVO.ptChidImgPath}" alt="참여고객 이미지" class="thumb" />
                        </c:if>
                            
                        <div class="user-area">
                            <strong class="name">${evntPtcChidVO.ptcChidNm }</strong>
                            <p class="text-area">${fn:replace(evntPtcChidVO.reb, lf, "<br/>")}</p>
                            <em class="date"><fmt:formatDate value="${evntPtcChidVO.rgstDtm}" pattern="hh:mm:ss, yyyy/MM/dd" /></em>
                             <a href="javascript:deletePtcChid('${evntPtcChidVO.evntPtcChidSn}')"><img src="/kr/images/common/button/btn_delete.gif" alt="댓글삭제" class="delete" /></a>
                        </div>
                    </c:if>
                    </div>
                    <c:forEach var="vo" items="${resultList}" varStatus="status">
                        <div class="section">
                            <c:if test="${vo.ptChidImgPath == null}">
                                <img src="/kr/temp/@none_50x50.jpg" alt="참여고객 이미지" class="thumb" />
                            </c:if>
                            <c:if test="${vo.ptChidImgPath != null}">
                                <a href="${vo.ptcChidLk}" target="_blank"><img src="${vo.ptChidImgPath}" alt="참여고객 이미지" class="thumb" /></a>
                            </c:if>
                            <div class="user-area">
                                <strong class="name">${vo.ptcChidNm }</strong>
                                <p class="text-area">${fn:replace(vo.reb, lf, "<br/>")}</p>
                                <em class="date"><fmt:formatDate value="${vo.rgstDtm}" pattern="hh:mm:ss, yyyy/MM/dd" /></em>
                                <!-- a href="#"><img src="/kr/images/common/button/btn_delete.gif" alt="댓글삭제" class="delete" /></a-->
                            </div>
                        </div>   
                    </c:forEach>
                </div>
                <c:if test="${paginationInfo.totalRecordCount > 0 }">
                    <div class="paging">
                        <able:pagination paginationInfo="${paginationInfo}" type="image" jsFunction="fnLinkPage" />
                    </div>
                </c:if>
            </div>
            </c:if>
            
            <c:if test="${result.evntType == 'E3'}">
            ${result.dtlImg}
            <div class="survey-wrap">
                <c:forEach var="vo" items="${resultList}" varStatus="status">
                    <div class="section">
                        <input type="hidden" name="num" value="${status.count }">
                        <input type="hidden" name="qustK" value="${vo.qustK}">
                        <input type="hidden" name="evntIsvyMnSn" value="${vo.evntIsvyMnSn }">
                        <input type="hidden" name="choiPsblIct" value="${vo.choiPsblIct }">
                        
                    <c:if test="${vo.qustK == 'Q1'}"><!-- 객관식 -->
                        <c:if test="${vo.choiPsblIct == 1}">
                            <p class="choose">${status.count }. ${vo.qustTitl }</p>
                            <c:if test="${vo.scrnLoc == 0}">
                                <ul class="row-type">
                                    <c:forEach var="voResult" items="${vo.evntIsvyVOList}" varStatus="statusVo">
                                        <li><label><input type="radio" class="check" name="E${vo.evntIsvyMnSn }" value="${voResult.evntIsvySn }" rspYn="${voResult.rspYn }" onclick="check10(this)"/> ${voResult.sbc }</label></li>
                                    </c:forEach>
                                </ul> 
                            </c:if> 
                           
                            <c:if test="${vo.scrnLoc == 1}">
                                <div class="col-type">
                                    <c:forEach var="voResult" items="${vo.evntIsvyVOList}" varStatus="statusVo">
                                    <c:if test="${statusVo.count == 1}">
                                        <label><input type="radio" class="check" name="E${vo.evntIsvyMnSn }" value="${voResult.evntIsvySn }" rspYn="${voResult.rspYn }" onclick="check10(this)"/> ${voResult.sbc }</label>
                                    </c:if>
                                    <c:if test="${statusVo.count > 1}">
                                        <label><input type="radio" class="check space" name="E${vo.evntIsvyMnSn }" value="${voResult.evntIsvySn }" rspYn="${voResult.rspYn }" onclick="check10(this)"/> ${voResult.sbc }</label>
                                    </c:if>
                                    </c:forEach>
                                </div> 
                            </c:if>
                        </c:if>
                        <c:if test="${vo.choiPsblIct != 1}">
                            <p class="choose">${status.count }. ${vo.qustTitl }</p>
                            <c:if test="${vo.scrnLoc == 0}">
                                <ul class="row-type">
                                    <c:forEach var="voResult" items="${vo.evntIsvyVOList}" varStatus="statusVo">
                                        <li><label><input type="checkbox" class="check" name="E${vo.evntIsvyMnSn }" value="${voResult.evntIsvySn }" rspYn="${voResult.rspYn }" onclick="check10(this)"/> ${voResult.sbc }</label></li>
                                    </c:forEach>
                                </ul> 
                            </c:if>
                            <c:if test="${vo.scrnLoc == 1}">
                                <div class="col-type">
                                    <c:forEach var="voResult" items="${vo.evntIsvyVOList}" varStatus="statusVo">
                                    <c:if test="${statusVo.count == 1}">
                                        <label><input type="checkbox" class="check" name="E${vo.evntIsvyMnSn }" value="${voResult.evntIsvySn }" rspYn="${voResult.rspYn }" onclick="check10(this)"/> ${voResult.sbc }</label>
                                    </c:if>
                                    <c:if test="${statusVo.count > 1}">
                                        <label><input type="checkbox" class="check space" name="E${vo.evntIsvyMnSn }" value="${voResult.evntIsvySn }" rspYn="${voResult.rspYn }" onclick="check10(this)"/> ${voResult.sbc }</label>
                                    </c:if>
                                    </c:forEach>
                                </div> 
                            </c:if>
                                                           
                        </c:if>
                    
                    </c:if>
                    <c:if test="${vo.qustK == 'Q2'}"><!-- 차수선택 -->
                        <p class="choose">${status.count }. ${vo.qustTitl }</p>
                        <div class="col-type">
                            <select class="select select-type1" style="width:190px;" name="E${vo.evntIsvyMnSn}" onclick="check20()">
                                <c:forEach var="voResult" items="${vo.evntIsvyVOList}" varStatus="statusvo">
                                    <option value="${voResult.evntIsvySn}">${voResult.sbc}</option>
                                </c:forEach>
                            </select>
                        </div>
                    </c:if>
                    <c:if test="${vo.qustK == 'Q3'}"><!-- 파일업로드 -->
                        <p class="choose">${status.count }. ${vo.qustTitl }</p>
                        <div class="col-type">
                            <input type="hidden" value="" name="E${vo.evntIsvyMnSn }" id="E${vo.evntIsvyMnSn }"/>
                            <input type="text" class="txt" style="width:215px;" title="${vo.qustTitl }" name="UP${vo.evntIsvyMnSn }" id="UP${vo.evntIsvyMnSn }" readonly="readonly"/>
                            <input type="image" src="/kr/images/common/button/btn_search.gif" alt="SEARCH"  id="EB${vo.evntIsvyMnSn }"/>
                            <p class="tip">- ${vo.upldPsblFil } 파일 형식만 가능합니다.</p>
                            <p class="tip">${vo.qustSbc}</p>
                        </div>
                        <script>
                        
                        var option = {        
                                uploadName : 'mnImgUpload',
                                fileReturnValue : '',
                                fileImgDiv : 'mnImgDownfile',
                                fileReturnType : 'path',
                                fileSelectFailMessage : '<spring:message code="script.errorMessage.fileSelect" />',
                                fileSuccessMessage : '<spring:message code="script.message.fileSuccess" />',
                                fileExt : '',
                                responseType : 'json', 
                                action: '/kr/file/upload.do', 
                                data : {
                                    //이미지 타입
                                    'fileType' : 'evnt',
                                    //파일 업로드 하위 경로
                                    'path' : 'evntUser/${result.evntMnSn }'
                                    },
                                autoSubmit: false,
                                onChange: function(file, ext){
                                    isLogin();
                                    var evntPtcChidVO = $("#evntPtcChidVO").val();
                                    if(evntPtcChidVO){
                                       alert("이미 이벤트에 응모 하셨습니다.");
                                       return false;
                                    }
                                    if(this.fileExt.indexOf(ext) == -1){
                                        if(this.fileReturnValue)
                                            $("#"+this.fileReturnValue).val('');
                                        if(this.fileNameValue)
                                            $("#"+this.fileNameValue).val('');
                                        alert("확장자를 확인해 주세요.");
                                        return false;
                                    }  
                                    var fileNameValue = $('#'+this.fileNameValue);
                                        fileNameValue.val(file);
                                    return true;
                                },
                                onSubmit : function(file, ext){
                                    if(this.fileExt.indexOf(ext) == -1){
                                        alert("확장자 확인해주세요.");
                                        return false;
                                    }
                                    if(file == null || file == ""){
                                        alert(this.fileSelectFailMessage);
                                        return false;
                                    }
                                    this.disable();  
                                },
                                onComplete: function(file, response){
                                    this.enable();
                                    var result={};
                                    if(response.filSn!="0"){
                                        $("#"+this.fileReturnValue).val(response.filSn);
                                    } 
                                    this.callback("E3");
                                },  
                                callback : function(type){
                                    if(uploadFiles.length > 0){
                                        var uploadFile = uploadFiles.pop();
                                        uploadFile.submit();
                                    }else{
                                        evntInsert(type);
                                    }
                                }  
                        };
                        option.fileReturnValue ='E${vo.evntIsvyMnSn}';
                        option.fileExt="${vo.upldPsblFil }";
                        option.name='EFB${vo.evntIsvyMnSn }';
                        option.fileNameValue='UP${vo.evntIsvyMnSn }';
                        //파일 업로드 객체 추가   
                        var uploadFile  = new AjaxUpload("EB${vo.evntIsvyMnSn }", option);
                        pushFiles(uploadFile);  
                        </script>  
                    </c:if>   
                    <c:if test="${vo.qustK == 'Q4'}"><!-- 주관식 -->
                        <p class="choose">${status.count }. ${vo.qustTitl }</p>
                        <div class="col-type">
                            <input type="text" class="txt" style="width:635px;" name="E${vo.evntIsvyMnSn }" title="" maxlength="500" onclick="check20()"/>
                        </div>
                    </c:if>
                    </div>
                </c:forEach>    
            </div>             
            </c:if>
            <c:if test="${result.evntType == 'E1' || result.evntType == 'E3'}">
            <div class="btnwrap">
                <div class="sns-area" style="margin-left : -200px"> 
                    <c:if test="${userInfo.mbrSn == null}">
                        <script type="text/javascript" charset="utf-8" src="${snsHttpsDomain}/sns/pub?type=5&js=1&uKey="></script>
                    </c:if>
                    <c:if test="${userInfo.mbrSn != null}">
                        <script type="text/javascript" charset="utf-8" src="${snsHttpsDomain}/sns/pub?type=5&js=1&uKey=${fnc:encryptCb(userInfo.mbrSn) }"></script>
                    </c:if>
                </div>
                <a href="javascript:evntInsertCheck('${result.evntType}')"><img src="/kr/images/common/button/btn_event_join.gif" alt="이벤트 응모하기" /></a>
            </div>
            <c:if test="${result.evntType != 'E2'}">
            
            <div class="sns-customer-wrap">
                <p class="desc"><img src="/kr/images/event/txt_event01_06.png" alt="이벤트에 참여하신 고객입니다" /></p>
                <div class="btnarea">
                    <button class="prevbutton"><img src="/kr/images/common/button/btn_sns_prev.gif" alt="이전" /></button>
                    <button class="nextbutton"><img src="/kr/images/common/button/btn_sns_next.gif" alt="다음" /></button>
                </div>
                <div class="listcutter"><div class="listcutter-inner">
                    <ul class="col9">
                        <c:forEach var="vo" items="${evntPtcChidList}" varStatus="status">
                        <li>
                            <div class="thumb-area">
                                <a href="javascript:openPopup('${vo.ptcChidLk }')">
                                <img src="${vo.ptChidImgPath }" alt="참여고객 이미지" class="thumb" onerror="this.src='/kr/temp/@none_50x50.jpg';" style="width: 50px;height: 50px"/>
                                </a> 
                                <div class="sns-icon">
                                <c:if test="${fn:indexOf(vo.ptcChidType, 'F') >= 0}">
                                    <img src="/kr/images/common/icon/icon_facebook.gif" alt="페이스북" />
                                </c:if>
                                <c:if test="${fn:indexOf(vo.ptcChidType, 'T') >= 0}">
                                    <img src="/kr/images/common/icon/icon_twitter.gif" alt="트위터" />
                                </c:if> 
                                <c:if test="${fn:indexOf(vo.ptcChidType, 'M') >= 0}">
                                    <img src="/kr/images/common/icon/icon_me2day.gif" alt="미투데이" />
                                </c:if>
                                </div>
                            </div>
                            <p class="name"><c:out value='${vo.ptcChidNick}'/></p>
                        </li>
                        </c:forEach>
                    </ul>
                </div></div>
            </div>
            </c:if>
            </c:if>
        </div>
    </div>
    <hr />
    <%@ include file="/WEB-INF/jsp/com/include/footer.jspf" %> 